﻿using System;
using System.Windows.Forms;

namespace EncryptionTest
{
    public partial class frmLogin : Form
    {
        public string Email
        {
            get;
            set;
        }
        public string Passphrase
        {
            get;
            set;
        }

        public frmLogin()
        {
            InitializeComponent();
            DialogResult = DialogResult.Cancel;
        }

        private void chkShowPassphrase_CheckedChanged(object sender, EventArgs e)
        {
            txtPassphrase.PasswordChar = chkShowPassphrase.Checked ? '\0' : '|';
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtEmail.Text.Trim()))
            {
                txtEmail.Focus();
                return;
            }
            if(string.IsNullOrEmpty(txtPassphrase.Text))
            {
                txtPassphrase.Focus();
                return;
            }

            Email = txtEmail.Text.Trim();
            Passphrase = txtPassphrase.Text;
            DialogResult = DialogResult.OK;
            Close();
        }

        private void frmLogin_Load(object sender, EventArgs e)
        {

        }
    }
}
